docs: add Syntax component for inline language-specific identifiers#2751
Conversation
Introduces a new auto-imported <Syntax py="..." ts="..." /> component that renders the correct identifier based on the global language toggle. Replaces manual patterns like "`snake_name` / `camelName`" in shared prose with a single reactive element. - New Syntax.astro component (custom element + inline script) - Auto-imported via astro-auto-import plugin - Converted ~26 instances across 16 doc pages - Updated agent skills, references, and contributor docs
|
Assessment: Comment Clean, well-scoped documentation addition. I spot-checked the converted identifiers against the SDK source ( Review themes
Nice quality-of-life improvement for the docs — the live language switching on inline identifiers is a real readability win. |
Address review feedback: - Render both Python and TypeScript content at build time with CSS-driven visibility (no empty flash, crawlable by default) - Remove unused data-code attribute - JS now toggles display:inline/none instead of setting textContent
|
Re-reviewed after
The remaining note (extracting the duplicated Updated assessment: Approve. Nice, quick turnaround. 👍 |
|
as a follow up, might be worth going through and ensuring that we actually have bilingual values for all of the code var references. Conversation management concept page is a good example of this; a lot of vars are cited as code, but do not have python/TS verisons. |
|
we can also probably remove a lot of the "In TypeScript, ModelRetryStrategy is the abstract base class. Use DefaultModelRetryStrategy for the standard configurable strategy:" type things now ! as a follow up |
|
Re-reviewed after
The two broader follow-up items from the maintainer (auditing all Assessment unchanged: Approve. All review threads resolved. |
…ntrib - Rename `code` prop to `plain` (default false) so the common case needs no prop and the rare case reads naturally as `plain` - Add proper Agent Skills section to contributing page with table and usage examples - Convert model.count_tokens() to <Syntax> in context-offloader
|
Re-reviewed after
Assessment unchanged: Approve. Clean refactor with consistent rollout. |
…anual variants Addresses @lizradway's review on strands-agents#2752: replace manually-spelled '(Python)/(TypeScript)' prose and the duplicated Configuration <Tabs> table with the <Syntax py=... ts=... /> component (owen's strands-agents#2751), per the mdx-authoring convention. - Stdio Mode prose: ask="stdio" / ask: 'stdio' -> <Syntax> - Custom UI Callback: drop 'In Python, both sync and async...' (the code tab already shows the language-specific form) - Configuration: collapse the two-tab Python/TypeScript table into a single table whose differing identifiers use <Syntax> - Trust Mode + Related Topics + Custom Evaluate prose: agent.state / appState and the True/'y'/'yes' approval spelling now use <Syntax> Merged main to pick up the <Syntax> component (strands-agents#2751) and the merged strands-agents#2750 code.
Description
Adds a new
<Syntax>MDX component that renders language-appropriate identifiers (Python snake_case vs TypeScript camelCase) inline based on the global language selector. This eliminates the manual pattern of spelling out both variants in shared prose (e.g.,`snake_name` / `camelName`).Motivation
Documentation pages frequently reference SDK identifiers in prose that sits outside language-specific tabs. Previously this meant writing both names inline, which was verbose, inconsistent across pages, and didn't react to the reader's language preference. The new component provides a single source of truth per identifier that switches live with the language toggle.
Public API Changes
No public API changes — this is a documentation infrastructure addition.
Component API
pytscodetrue<code>(false for plain text)Implementation
site/src/components/Syntax.astro— custom element<syntax-switch>with an idempotent inline script that reads the same localStorage key as the existing language tabsastro-auto-importso no explicit imports needed in MDX.lang-optiondelegated listener) and cross-tabstorageeventsScope
Type of Change
Documentation update
Testing
npx astro buildpasses (655 pages, 0 broken links)sdk-typescript/strands-ts/src/Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.